<!DOCTYPE html>
<html>
  <head>
    <title>demo</title>
    <style type="text/css">
      html,
      body {
        margin: 0;
        padding: 0;
      }
      .box {
        height: 3000px;
      }
      .container {
        height: 500px;
        width: 50px;
        background-color: red;
        position: absolute;
        left: 200px;
        top: 50px;
      }
      .sticky {
        height: 50px;
        width: 100%;
        position: sticky;
        top: 10px;
        background-color: blue;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="container">
        <div class="sticky"></div>
      </div>
    </div>
  </body>
</html>
